package org.cable.link.service;

import com.baomidou.mybatisplus.extension.service.IService;
import org.cable.common.model.EventMessage;
import org.cable.common.util.JsonData;
import org.cable.link.controller.request.ShortLinkAddRequest;
import org.cable.link.controller.request.ShortLinkDelRequest;
import org.cable.link.controller.request.ShortLinkPageRequest;
import org.cable.link.controller.request.ShortLinkUpdateRequest;
import org.cable.link.model.ShortLinkDO;
import org.cable.link.vo.ShortLinkVO;

import java.util.Map;

/**
 * <p>
 *  服务类
 * </p>
 *
 * @author hsj
 * @since 2023-10-30
 */
public interface ShortLinkService extends IService<ShortLinkDO> {


    /**
     * 解析短链
     * @param shortLinkCode 短链码
     * @return
     */
    ShortLinkVO parseShortLinkCode(String shortLinkCode);

    /**
     * 创建短链
     * @param request
     * @return
     */
    JsonData createShortLink(ShortLinkAddRequest request);


    /**
     * 处理新增短链消息
     * @param eventMessage
     * @return
     */
    boolean handleAddShortLink(EventMessage eventMessage);

    /**
     * 处理删除短链消息
     * @param eventMessage
     * @return
     */
    boolean handleDelShortLink(EventMessage eventMessage);


    /**
     * 处理更新短链消息
     * @param eventMessage
     * @return
     */
    boolean handleUpdateShortLink(EventMessage eventMessage);


    /**
     * 分页查找短链
     * @param shortLinkPageRequest
     * @return
     */
    Map<String, Object> pageByGroupId(ShortLinkPageRequest shortLinkPageRequest);

    /**
     * 删除短链
     * @param request
     * @return
     */
    JsonData del(ShortLinkDelRequest request);

    /**
     * 跟新短链
     * @param request
     * @return
     */
    JsonData updateShortLink(ShortLinkUpdateRequest request);
}
